package com.cn.wanxi.service;

import com.cn.wanxi.dao.NavDao;
import com.cn.wanxi.model.NavModel;

public class NavService {
    public NavModel[] getNavModels() {
        NavModel[] navModels = new NavModel[6];
//        NavModel navModel = new NavModel();
//        navModel.setHref("1");
//        navModel.setTitle("1");
//        数组的下标（索引）从0开始
//        navModels[0] = navModel;
//        NavModel navModel2 = new NavModel();
//        navModel2.setHref("12");
//        navModel2.setTitle("12");
//        navModels[3] = navModel2;
//        System.out.println(navModels[3].getTitle());
        NavDao navDao = new NavDao();
//        要拿取数组种的数据：遍历
        for (int i = 0; i < navModels.length; i++) {
//            System.out.println(navModels[i].getHref());
            NavModel model = new NavModel();
            model.setTitle(navDao.titles[i]);
            model.setHref(navDao.hrefs[i]);
            navModels[i] = model;
        }
        return navModels;
    }

    public static void main(String[] args) {
        new NavService().getNavModels();
    }
}
